<?php
$width=Yii::app()->params['dialog']['findTruckForConfirm']['width'];
$height=Yii::app()->params['dialog']['findTruckForConfirm']['height'];
$width1=Yii::app()->params['dialog']['findBoardForConfirm']['width'];
$height1=Yii::app()->params['dialog']['findBoardForConfirm']['height'];
$width2=Yii::app()->params['dialog']['findDriverForConfirm']['width'];
$height2=Yii::app()->params['dialog']['findDriverForConfirm']['height'];
$width3=Yii::app()->params['dialog']['findConsignorForConfirm']['width'];
$height3=Yii::app()->params['dialog']['findConsignorForConfirm']['height'];
$width4=Yii::app()->params['dialog']['findConsignorLinkmanForConfirm']['width'];
$height4=Yii::app()->params['dialog']['findConsignorLinkmanForConfirm']['height'];
$width5=Yii::app()->params['dialog']['findConsigneeForConfirm']['width'];
$height5=Yii::app()->params['dialog']['findConsigneeForConfirm']['height'];
$width6=Yii::app()->params['dialog']['findConsigneeLinkmanForConfirm']['width'];
$height6=Yii::app()->params['dialog']['findConsigneeLinkmanForConfirm']['height'];
$width7=Yii::app()->params['dialog']['findGoodsNameForConfirm']['width'];
$height7=Yii::app()->params['dialog']['findGoodsNameForConfirm']['height'];
$width8=Yii::app()->params['dialog']['findPathForConfirm']['width'];
$height8=Yii::app()->params['dialog']['findPathForConfirm']['height'];
$cs=Yii::app()->clientScript;
$cs->registerScriptFile('./js/modal.js');
$cs->registerScript('driver_confirm_dialog',<<<END
var patrn=/[0-9]{1,20}/; var truck_fuel,check_merit;
function Block(){\$.modal('?r=dialog/findTruckForConfirm&app_time='+'$model->appointment_time'.substr(0,7)+'-01',{width:$width,height:$height,title:'请选择车辆'});return false;}
function Block1(){\$.modal('?r=dialog/findBoardForConfirm',{height:$height1,width:$width1,title:'请选择尾板'});return false;}
function Block2(nb){\$.modal('?r=dialog/findDriverForConfirm&driver_number='+nb,{height:$height2,width:$width2,title:'请选择司机'});}
function Block3(n){\$.modal('?r=dialog/findConsignorForConfirm&n='+n,{height:$height3,width:$width3,title:'请选择货主(发货人)'});return false;}
function Block4(id,n){\$.modal('?r=dialog/findConsignorLinkmanForConfirm&consignor_id='+id+'&n='+n,{height:$height4,width:$width4,title:'请选择装货地'});return false;}
function Block5(n){\$.modal('?r=dialog/findConsigneeForConfirm&n='+n,{height:$height5,width:$width5,title:'请选择客户(收货人)'});return false;}
function Block6(id,n){\$.modal('?r=dialog/findConsigneeLinkmanForConfirm&consignee_id='+id+'&n='+n,{height:$height6,width:$width6,title:'请选择卸货地'});return false;}
function Block7(id,n){\$.modal('?r=dialog/findGoodsNameForConfirm&consignor_id='+id+'&n='+n,{height:$height7,width:$width7,title:'请选择货物名称'});return false;}
function Block8(n){\$.modal('?r=dialog/findPathForConfirm&n='+n,{height:$height8,width:$width8,title:'请选择线路'});return false;}
$("#findTruck").click(Block);
$("#findBoard").click(Block1);
$("a[id^=findDriver]").click(function(){Block2(patrn.exec($(this).attr('id')));return false;});
$("#delDriver").click(function(){\$("#Confirm_sheet_driver2_name").val('');$("#Confirm_sheet_driver2_mobile").val('');return false;});
$("#delBoard").click(function(){\$("#Confirm_sheet_board_plate_no").val('');$("#Confirm_sheet_type").val($("#truck_type").val());$("#Confirm_sheet_compute_ratio").val($("#truck_type_ratio").val());return false;});
$("a[id^=findConsignor]").click(function(){Block3(patrn.exec($(this).attr('id')));return false;});
$("a[id^=findLoadingPlace]").click(function(){var n=patrn.exec($(this).attr('id'));Block4($("#goods_"+n+"_fk_consignor_id").val(),n);return false;});
$("a[id^=findConsignee]").click(function(){Block5(patrn.exec($(this).attr('id')));return false;});
$("a[id^=findPodPlace]").click(function(){var n=patrn.exec($(this).attr('id'));Block6($("#goods_"+n+"_fk_consignee_id").val(),n);return false;});
$("a[id^=findGoodsName]").click(function(){var n=patrn.exec($(this).attr('id'));Block7($("#goods_"+n+"_fk_consignor_id").val(),n);return false;});
$("a[id^=findPath]").click(function(){Block8(patrn.exec($(this).attr('id')));return false;});

function make_name(info){\$(info).each(function(i,item){\$(item).find("input[type!=button],textarea,select").each(function(n,obj){var re=/\d{1,10}/g;obj.name=obj.name.replace(re,String(i));});});}
var info_n=100;
function info(main,info,add_btn,del_btn,sh_btn){this.main=main;this.info=info;this.init=function(){\$(add_btn).click(this.add_info);$(del_btn).click(this.del_info);}
this.add_info=function(){info_n+=1; 
var f=$(info+":first").clone(true);f.find("input[type!=button],textarea,select").val('').removeClass('error').each(function(i,obj){var re=/\d{1,10}/g;obj.id=obj.id.replace(re,info_n);});f.find("a").each(function(i,obj){var re=/\d{1,10}/g;obj.id=obj.id.replace(re,info_n);});f.find("span[class=error]").remove();f.appendTo(main);make_name(info);if($(sh_btn).attr('class')=='hide')$(sh_btn).click();findLoadingPlace();create_goods_cal(info_n);}
$(sh_btn).click(function(){if($(this).attr('class')=='show'){\$(main).hide(50);$(this).attr('class','hide').val('显示');$("#info_line").hide();}else{\$(main).show(50);$(this).attr('class','show').val('隐藏');$("#info_line").show();}});this.del_info=function(){if($(info).length<2)return;$(this).parents(info).remove();make_name(info);}}

function info1(main,info,info_del,add_btn,del_btn,sh_btn){this.main=main;this.info=info;this.init=function(){\$(add_btn).click(this.add_info);$(del_btn).click(this.del_info);}
this.add_info=function(){info_n+=1; 
var f=$(info+":first").clone(true);f.find("input[type!=button],textarea,select").val('').each(function(i,obj){var re=/\d{1,10}/g;obj.id=obj.id.replace(re,info_n);});f.attr('class',info_del.substring(1)).appendTo(main);make_name(info_del);if($(sh_btn).attr('class')=='hide')$(sh_btn).click();}
$(sh_btn).click(function(){if($(this).attr('class')=='show'){\$(main).hide(50);$(this).attr('class','hide').val('显示');$("#info_line").hide();}else{\$(main).show(50);$(this).attr('class','show').val('隐藏');$("#info_line").show();}});this.del_info=function(){\$(this).parents(info_del).remove();make_name(info_del);}}

function info2(main,info,add_btn,del_btn,sh_btn){this.main=main;this.info=info;this.init=function(){\$(add_btn).click(this.add_info);$(del_btn).click(this.del_info);}
this.add_info=function(){info_n+=1; 
var f=$(info+":first").clone(true);f.find("input[type!=button],textarea,select").val('').removeClass('error').each(function(i,obj){var re=/\d{1,10}/g;obj.id=obj.id.replace(re,info_n);});f.find("a").each(function(i,obj){var re=/\d{1,10}/g;obj.id=obj.id.replace(re,info_n);});f.find("span[class=error]").remove();f.appendTo(main);make_name(info);if($(sh_btn).attr('class')=='hide')$(sh_btn).click();}
$(sh_btn).click(function(){if($(this).attr('class')=='show'){\$(main).hide(50);$(this).attr('class','hide').val('显示');$("#info_line").hide();}else{\$(main).show(50);$(this).attr('class','show').val('隐藏');$("#info_line").show();}});this.del_info=function(){if($(info).length<2)return;$(this).parents(info).remove();make_name(info);}}

var t=new info("#goods",".goods_main","#add_goods",'.del_goods','#sh_goods');t.init();
var t1=new info1("#deadhead_info",".deadhead_temp",".deadhead_main","#add_deadhead",'.del_deadhead','#sh_deadhead');t1.init();
var t2=new info("#gas",".gas_main","#add_gas",'.del_gas_fee','#sh_gas_fee');t2.init();
var t3=new info1("#extra_info",".extra_temp",".extra_main","#add_extra",'.del_extra','#sh_extra');t3.init();

function create_goods_cal(n){
var id='#goods_'+n+'_demand_deliver_time';if($(id).length>0)Calendar.setup({inputField:'goods_'+n+'_demand_deliver_time',ifFormat:'%Y-%m-%d %H:%M',weekNumbers:'',showsTime:'1'});
var id='#goods_'+n+'_demand_arrival_time';if($(id).length>0)Calendar.setup({inputField:'goods_'+n+'_demand_arrival_time',ifFormat:'%Y-%m-%d %H:%M',weekNumbers:'',showsTime:'1'});
var id='#goods_'+n+'_actual_arrival_time';if($(id).length>0)Calendar.setup({inputField:'goods_'+n+'_actual_arrival_time',ifFormat:'%Y-%m-%d %H:%M',weekNumbers:'',showsTime:'1'});
}
function status_sel(){
	var stat=$("#Confirm_sheet_loading_status").val();
	if(stat==0){
		$("#heaven").appendTo("#app_info");
		$("#empty").appendTo("#temp");
		$("#driving_info").insertAfter("#app_info");
		$("#income_info").insertAfter("#driving_info");
		$("#cost_info").insertAfter("#income_info");
		$("#calculate_mileage").show();
		$("#compute_ratio").show().find("input[type=text]").val(parseInt($model->compute_ratio*100));
		$("#compute_ratio_blank").hide();
	}else{
		$("#empty").appendTo("#app_info");
		$("#heaven").appendTo("#temp");
		$("#income_info").appendTo("#temp");
		$("#cost_info").appendTo("#temp");
		$("#driving_info").appendTo("#temp");
		$("#calculate_mileage").hide();
		$("#compute_ratio").hide().find("input[type=text]").val(0);
		$("#compute_ratio_blank").show();
	}
}
function check_truck_fuel(){
	var vaild=true;
	var validator=$("form").validate();
	vaild=validator.element($('#Confirm_sheet_truck_plate_no'))?vaild:false;
	//vaild=validator.element($('#Confirm_sheet_type'))?vaild:false;
	if(!vaild)return;
	$.ajax({'type':'POST','url':'?r=confirm_sheet/checkTruckFuel','async':false,'cache':false,'data':'truck_id='+$("#Confirm_sheet_fk_truck_id").val()+'&time='+'$model->appointment_time'.substr(0,7),'success':function(data){truck_fuel=data;}});
	if(truck_fuel!=1) {alert("此车辆相对应时间段的标准油耗信息不存在,请添加此车辆标准油耗!");return false;}
	return true;
}
function check_truck_merit(){
	var vaild=true;
	var validator=$("form").validate();
	vaild=validator.element($('#Confirm_sheet_truck_plate_no'))?vaild:false;
	//vaild=validator.element($('#Confirm_sheet_type'))?vaild:false;
	if(!vaild)return;
	$.ajax({'type':'POST','url':'?r=confirm_sheet/checkTruckMerit','async':false,'cache':false,'data':'truck_id='+$("#Confirm_sheet_fk_truck_id").val()+'&time='+'$model->appointment_time'.substr(0,7),'success':function(data){check_merit=data;}});
	if(check_merit!=1) {alert("此车辆相对应时间段的绩效工资核算系数不存在,请添加此车辆绩效核算系数!");return false;}
	return true;
}
$('form').submit(check_truck_fuel);
$('form').submit(check_truck_merit);
$('form').submit(calculate_mileage);

function calculate_fuel_mileage(check){
	if(arguments[0]){
		var vaild=true;
		var validator=$("form").validate();
		validator.resetForm();
		$("#goods").find("[id^=goods_][id$=_path_mileage]").each(function(i,item){vaild=validator.element($(item))?vaild:false;});
		$("#deadhead_info").find("[id^=deadhead_][id$=_mileage]").each(function(i,item){vaild=validator.element($(item))?vaild:false;});
		if(!vaild) {alert('请填写完整信息!');return;}
	}
	
	var sum=[0,0,0,0],type=[],temp=[];
	var getFuelCode=function(fule_name){var c=0; if(fule_name=='front_driving') c=0;else if(fule_name=='empty_driving') c=1;else if(fule_name=='light_driving') c=2;else if(fule_name=='heavy_driving') c=3; return c;};
	$("#goods").find("[id^=goods_][id$=_fuel_name]").each(function(i,item){type.push(getFuelCode($(item).val()));});
	$("#deadhead_info").find("[id^=deadhead_][id$=_fuel_name]").each(function(i,item){type.push(getFuelCode($(item).val()));});
	
	$("#goods").find("[id^=goods_][id$=_path_mileage]").each(function(i,item){temp.push($(item).val());});
	$("#deadhead_info").find("[id^=deadhead_][id$=_mileage]").each(function(i,item){temp.push($(item).val());});
	
	for(var i=0;i<type.length;i++){sum[type[i]]+=parseFloat(temp[i],10);}
	$("#Confirm_sheet_front_mileage").val(Math.round(sum[0]*100)/100);  $("#Confirm_sheet_actual_front_mileage").val(Math.round(sum[0]*100)/100);
	$("#Confirm_sheet_empty_mileage").val(Math.round(sum[1]*100)/100);  $("#Confirm_sheet_actual_empty_mileage").val(Math.round(sum[1]*100)/100); 
	$("#Confirm_sheet_light_mileage").val(Math.round(sum[2]*100)/100);  $("#Confirm_sheet_actual_light_mileage").val(Math.round(sum[2]*100)/100); 
	$("#Confirm_sheet_heavy_mileage").val(Math.round(sum[3]*100)/100);  $("#Confirm_sheet_actual_heavy_mileage").val(Math.round(sum[3]*100)/100);  
}
$("#calculate_fuel_mileage").click(calculate_fuel_mileage);

function calculate_mileage(){
	if($("#Confirm_sheet_loading_status").val()==1) return true;
	var vaild=true;
	var validator=$("form").validate();
	var sum=0;
	validator.resetForm();
	vaild=validator.element($("#Confirm_sheet_actual_front_mileage"))?vaild:false;
	vaild=validator.element($("#Confirm_sheet_actual_light_mileage"))?vaild:false;
	vaild=validator.element($("#Confirm_sheet_actual_empty_mileage"))?vaild:false;
	vaild=validator.element($("#Confirm_sheet_actual_heavy_mileage"))?vaild:false;
	if(!vaild) {alert('请填写完整信息!');return;}
	
	sum+=parseFloat($("#Confirm_sheet_actual_front_mileage").val(),10);
	sum+=parseFloat($("#Confirm_sheet_actual_light_mileage").val(),10);
	sum+=parseFloat($("#Confirm_sheet_actual_empty_mileage").val(),10);
	sum+=parseFloat($("#Confirm_sheet_actual_heavy_mileage").val(),10);
	$("#Confirm_sheet_mileage").val(Math.round(sum*100)/100);
}
$("#calculate_mileage").click(calculate_mileage);
function calculate_gas(){
	par=$(this).parents(".gas_main");
	var vaild=true;
	var validator=$("form").validate();
	validator.resetForm();
	vaild=validator.element(par.find("[id^=gas_][id$=_unit_price]"))?vaild:false;
	vaild=validator.element(par.find("[id^=gas_][id$=_amount]"))?vaild:false;
	if(!vaild) {alert('请填写完整信息!');return;}
	
	var cost=parseFloat(par.find("[id^=gas_][id$=_unit_price]").val(),10)*parseFloat(par.find("[id^=gas_][id$=_amount]").val(),10);
	par.find("[id^=gas_][id$=_cost]").val(Math.round(cost*100)/100);
}
$(".calculate_gas_fee").click(calculate_gas);
function calculate_toal_cost(){
	var sum=0;
	var vaild=true;
	var validator=$("form").validate();
	validator.resetForm();
	$("#gas").find("[id^=gas_][id$=_cost]").each(function(i,item){vaild=validator.element($(item))?vaild:false;});
	$("#extra_info").find("[id^=extra_][id$=_cost]").each(function(i,item){vaild=validator.element($(item))?vaild:false;});
	vaild=validator.element($("#Confirm_sheet_bridge_charge"))?vaild:false;
	vaild=validator.element($("#Confirm_sheet_amerce_cost"))?vaild:false;
	vaild=validator.element($("#Confirm_sheet_driver_salary"))?vaild:false;
	vaild=validator.element($("#Confirm_sheet_damage_cost"))?vaild:false;
	if(!vaild) {alert('请填写完整信息!');return;}
	
	$("#gas").find("[id^=gas_][id$=_cost]").each(function(i,item){sum+=parseFloat($(item).val(),10);});
	$("#extra_info").find("[id^=extra_][id$=_cost]").each(function(i,item){sum+=parseFloat($(item).val(),10);});
	sum+=parseFloat($("#Confirm_sheet_bridge_charge").val(),10);
	sum+=parseFloat($("#Confirm_sheet_amerce_cost").val(),10);
	sum+=parseFloat($("#Confirm_sheet_driver_salary").val(),10);
	sum+=parseFloat($("#Confirm_sheet_damage_cost").val(),10);
	$("#Confirm_sheet_total_cost").val(Math.round(sum*100)/100);
}
$("#calculate_total_cost").click(calculate_toal_cost);
function calculate_toal_profit(){
	var vaild=true;
	var validator=$("form").validate();
	validator.resetForm();
	vaild=validator.element($("#Confirm_sheet_total_amount"))?vaild:false;
	vaild=validator.element($("#Confirm_sheet_total_cost"))?vaild:false;
	if(!vaild) {alert('请填写完整信息!');return;}
	
	var profit=parseFloat($("#Confirm_sheet_total_amount").val()-$("#Confirm_sheet_total_cost").val());
	$("#Confirm_sheet_total_profit").val(Math.round(profit*100)/100);
}
$("#calculate_total_profit").click(calculate_toal_profit);
function calculate_driver_salary(check){
	if(arguments[0]){
		var vaild=true;
		var validator=$("form").validate();
		validator.resetForm();
		vaild=validator.element($("#Confirm_sheet_compute_ratio"))?vaild:false;
		$("#goods").find("[id^=goods_][id$=_origin]").each(function(i,item){vaild=validator.element($(item))?vaild:false;});
		$("#goods").find("[id^=goods_][id$=_destination]").each(function(i,item){vaild=validator.element($(item))?vaild:false;});
		$("#goods").find("[id^=goods_][id$=_path_mileage]").each(function(i,item){vaild=validator.element($(item))?vaild:false;});
		$("#goods").find("[id^=goods_][id$=_driver_salary]").each(function(i,item){vaild=validator.element($(item))?vaild:false;});
		vaild=validator.element($("#Confirm_sheet_compute_ratio"))?vaild:false;
		if(!vaild) {alert('请填写完整信息!');return;}
	}
	var sum=0;
	$("#goods").find("[id^=goods_][id$=_driver_salary]").each(function(i,item){sum+=parseFloat($(item).val(),10);});
	sum*=$("#Confirm_sheet_compute_ratio").val()/100;
	if($("#Confirm_sheet_driver2_name").val()!='') sum*=2*0.7;
	$("#Confirm_sheet_driver_salary").val(Math.round(sum*100)/100);
}
$("#calculate_driver_salary").click(calculate_driver_salary);
function amount_kind_sel(){
	if($("#Confirm_sheet_amount_kind").val()==0){
		$("#Confirm_sheet_balance").parent('div').insertAfter("#amount_kind").show();
		$("#Confirm_sheet_advance_payment").parent('div').insertAfter("#amount_kind").show();
		$("#Confirm_sheet_special_reasons").removeClass('error').next('span[class=error]').remove().end().parent('div').appendTo("#temp").hide();
	}
	else if($("#Confirm_sheet_amount_kind").val()==1){
		$("#Confirm_sheet_advance_payment").removeClass('error').next('span[class=error]').remove().end().parent('div').appendTo("#temp").hide();
		$("#Confirm_sheet_balance").removeClass('error').next('span[class=error]').remove().end().parent('div').appendTo("#temp").hide();
		$("#Confirm_sheet_special_reasons").removeClass('error').next('span[class=error]').remove().end().parent('div').appendTo("#temp").hide();
	}
	else if($("#Confirm_sheet_amount_kind").val()==2){
		$("#Confirm_sheet_advance_payment").removeClass('error').next('span[class=error]').remove().end().parent('div').appendTo("#temp").hide();
		$("#Confirm_sheet_balance").removeClass('error').next('span[class=error]').remove().end().parent('div').appendTo("#temp").hide();
		$("#Confirm_sheet_special_reasons").parent('div').insertAfter("#amount_kind").show();
	}
}
function findLoadingPlace(){
	$("[id^=goods_][id$=_consignor_name]").each(function(i,item){var n=patrn.exec($(item).attr('id'));var s="#findLoadingPlace"+n;if($(item).val()!='') $(s).show(); else $(s).hide();});
	$("[id^=goods_][id$=_consignor_name]").each(function(i,item){var n=patrn.exec($(item).attr('id'));var s="#findGoodsName"+n;if($(item).val()!='') $(s).show(); else $(s).hide();});
	$("[id^=goods_][id$=_consignee_name]").each(function(i,item){var n=patrn.exec($(item).attr('id'));var s="#findPodPlace"+n;if($(item).val()!='') $(s).show(); else $(s).hide();});
} 
$("#Confirm_sheet_amount_kind").change(amount_kind_sel);
$("#Confirm_sheet_loading_status").change(status_sel);
amount_kind_sel();
status_sel();
findLoadingPlace();
if('$update'==''&&$("#Confirm_sheet_loading_status").val()==0){calculate_fuel_mileage(false);calculate_driver_salary(false);/**calculate_mileage();**/}
END
)
?>
<div class="yiiForm"  style="width:803px;">
<?php
	echo EHtml::form();	
	EHtml::setOptions(array('errorElement'=> 'span'));
	EHtml::setScenario('all');				  		
?>
<div>注：<span class="required">*</span>为必填项</div>
<div id="basic_info">
<div style="width:781px;margin-left:0px;border-bottom:0px;padding-left:20px;border:1px solid #90b3bc;height:30px;border-bottom:0px;line-height:30px;"><strong>车辆基本信息</strong></div>
<div id="leftaa"  style="width:400px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'loading_status',array('class'=>'label_left100',)); ?>

<?php echo EHtml::activeDropDownList($model,'loading_status',$model->getLoadingStatusNames()); ?>

</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'truck_plate_no'); ?>
<?php echo EHtml::activeTextField($model,'truck_plate_no',array('readOnly'=>'true','size'=>10,'class'=>'readonly')); ?>&nbsp;&nbsp;<a id="findTruck" href="#">查找车辆</a>
<?php echo CHtml::activeHiddenField($model,'fk_truck_id'); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'board_plate_no'); ?>
<?php echo EHtml::activeTextField($model,'board_plate_no',array('readOnly'=>'true','size'=>15,'class'=>'readonly')); ?>&nbsp;&nbsp;<a id="findBoard" href="#">查找尾板</a>&nbsp;&nbsp;<a id="delBoard" href="#">删除</a>
</div>
<div class="simple1" style="width:400px;border-bottom:0px;">
<?php echo CHtml::activeLabelEx($model,'type'); ?>
<?php echo EHtml::activeTextField($model,'type',array('readOnly'=>'true','size'=>10,'class'=>'readonly')); ?>
<?php echo CHtml::activeHiddenField($model,'truck_type',array('id'=>'truck_type')); ?>
<?php echo CHtml::activeHiddenField($model,'truck_type_ratio',array('id'=>'truck_type_ratio','value'=>$model->truck_type_ratio*100)); ?>
</div>
</div>
  <div id="rightaa"  style="width:400px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'driver1_name'); ?>
<?php echo EHtml::activeTextField($model,'driver1_name',array('readOnly'=>'true','size'=>10,'class'=>'readonly')); ?>&nbsp;&nbsp;<a id="findDriver1" href="#">查找司机</a>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'driver1_mobile'); ?>
<?php echo EHtml::activeTextField($model,'driver1_mobile',array('readOnly'=>'true','size'=>14,'class'=>'readonly')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'driver2_name'); ?>
<?php echo EHtml::activeTextField($model,'driver2_name',array('readOnly'=>'true','size'=>10,'class'=>'readonly')); ?>&nbsp;&nbsp;<a id="findDriver2" href="#">查找司机</a> 
</div>
<div class="simple1" style="width:400px;border-bottom:0px;">
<?php echo CHtml::activeLabelEx($model,'driver2_mobile'); ?>
<?php echo EHtml::activeTextField($model,'driver2_mobile',array('readOnly'=>'true','size'=>14,'class'=>'readonly')); ?><a id="delDriver" href="#">&nbsp;&nbsp;删除</a>
</div>
</div>
<div>
<div id="leftaa"  style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'appointment_time'); ?>
<?php echo $model->appointment_time;?>
</div>
</div>
<div id="rightaa"   style="width:400px;border-top:0px;">
<div class="simple" id="compute_ratio">
<?php echo CHtml::activeLabelEx($model,'compute_ratio'); ?>
<?php echo EHtml::activeTextField($model,'compute_ratio',array('size'=>10,'value'=>$model->compute_ratio*100)); ?>
</div>
<div class="simple" id="compute_ratio_blank" style="display:none"></div>
</div>
</div>
</div>
<!-- end basic_info -->
<div id="app_info">
<div id="heaven">
<div id="goods_btn" style="border:1px solid #90b3bc;border-top:0px;padding-left:20px;"><strong>货物信息</strong>
<input type="button" id="add_goods" value="添加货物信息"/><input id="sh_goods" class="show" type="button" value="隐藏"/>
</div>
<div id="goods">
<?php foreach($goods_models as $n=>$goods):?>
<div class="goods_main">
<div id="leftaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'consignor_name'); ?>
<?php echo CHtml::activeTextField($goods,'consignor_name',array('name'=>"goods[{$n}][consignor_name]",'readOnly'=>'true','class'=>'readonly required')); ?>&nbsp;&nbsp;<a id="findConsignor<?php echo $n;?>" href="#">查找货主</a>
<?php echo CHtml::activeHiddenField($goods,'fk_consignor_id',array('name'=>"goods[{$n}][fk_consignor_id]")); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'loading_place'); ?>
<?php echo CHtml::activeTextField($goods,'loading_place',array('name'=>"goods[{$n}][loading_place]",'class'=>'required','size'=>20,'maxlength'=>30)); ?>&nbsp;&nbsp;<a id="findLoadingPlace<?php echo $n;?>" style="display:none" href="#">查找装货地</a>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'consignor_link_name'); ?>
<?php echo CHtml::activeTextField($goods,'consignor_link_name',array('name'=>"goods[{$n}][consignor_link_name]",'class'=>'required','size'=>11,'maxlength'=>11)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'consignor_link_tel'); ?>
<?php echo CHtml::activeTextField($goods,'consignor_link_tel',array('name'=>"goods[{$n}][consignor_link_tel]",'class'=>'required','size'=>18,'maxlength'=>18)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'consignee_name'); ?>
<?php echo CHtml::activeTextField($goods,'consignee_name',array('name'=>"goods[{$n}][consignee_name]",'readOnly'=>'true','class'=>'readonly required')); ?>&nbsp;&nbsp;<a id="findConsignee<?php echo $n;?>" href="#">查找客户</a>
<?php echo CHtml::activeHiddenField($goods,'fk_consignee_id',array('name'=>"goods[{$n}][fk_consignee_id]")); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'actual_consignee'); ?>
<?php echo CHtml::activeTextField($goods,'actual_consignee',array('name'=>"goods[{$n}][actual_consignee]",'class'=>'required','maxlength'=>100)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'pod_place'); ?>
<?php echo CHtml::activeTextField($goods,'pod_place',array('name'=>"goods[{$n}][pod_place]",'class'=>'required','size'=>20,'maxlength'=>30)); ?>&nbsp;&nbsp;<a id="findPodPlace<?php echo $n;?>" style="display:none" href="#">查找卸货地</a>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'consignee_link_name'); ?>
<?php echo CHtml::activeTextField($goods,'consignee_link_name',array('name'=>"goods[{$n}][consignee_link_name]",'class'=>'required','size'=>11,'maxlength'=>11)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'consignee_link_tel'); ?>
<?php echo CHtml::activeTextField($goods,'consignee_link_tel',array('name'=>"goods[{$n}][consignee_link_tel]",'class'=>'required','size'=>18,'maxlength'=>18)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'goods_name'); ?>
<?php echo CHtml::activeTextField($goods,'goods_name',array('name'=>"goods[{$n}][goods_name]",'class'=>'required','size'=>18,'maxlength'=>20)); ?>&nbsp;&nbsp;<a id="findGoodsName<?php echo $n;?>" style="display:none" href="#">查找货物名称</a>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'pack_type'); ?>
<?php echo CHtml::activeDropDownList($goods,'pack_type',$goods->getPackTypeNames(),array('name'=>"goods[{$n}][pack_type]")); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'lift_kind'); ?>
<?php echo CHtml::activeDropDownList($goods,'lift_kind',$goods->getLiftKindNames(),array('name'=>"goods[{$n}][lift_kind]")); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'unit_name'); ?>
<?php echo CHtml::activeDropDownList($goods,'unit_name',$goods->getUnitNames(),array('name'=>"goods[{$n}][unit_name]")); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'amount'); ?>
<?php echo CHtml::activeTextField($goods,'amount',array('name'=>"goods[{$n}][amount]",'size'=>10,'class'=>'required','format'=>'%.2f','my_float'=>8.2)); ?>
</div>
<div class="simple"  style="border-bottom:0px;">
</div>
</div>
  <div id="rightaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'time_costing'); ?>
<?php echo CHtml::activeDropDownList($goods,'time_costing',$goods->getTimeCostingNames(),array('name'=>"goods[{$n}][time_costing]")); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'origin'); ?>
<?php echo CHtml::activeTextField($goods,'origin',array('name'=>"goods[{$n}][origin]",'readOnly'=>'true','class'=>'readonly required')); ?>&nbsp;&nbsp;<a id="findPath<?php echo $n;?>" href="#">查找线路</a>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'destination'); ?>
<?php echo CHtml::activeTextField($goods,'destination',array('name'=>"goods[{$n}][destination]",'readOnly'=>'true','class'=>'readonly required')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'path_mileage'); ?>
<?php echo CHtml::activeTextField($goods,'path_mileage',array('size'=>10,'name'=>"goods[{$n}][path_mileage]",'readOnly'=>'true','class'=>'readonly required')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'driver_salary'); ?>
<?php echo CHtml::activeTextField($goods,'driver_salary',array('size'=>10,'name'=>"goods[{$n}][driver_salary]",'class'=>'required','my_float'=>16.2,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'fuel_name'); ?>
<?php if(empty($goods->fuel_name)) $goods->fuel_name='heavy_driving';?>
<?php echo CHtml::activeDropDownList($goods,'fuel_name',$goods->getFuelNames(),array('name'=>"goods[{$n}][fuel_name]")); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'driving_circuit'); ?>
<?php echo CHtml::activeDropDownList($goods,'driving_circuit',$goods->getDrivingCircuitNames(),array('name'=>"goods[{$n}][driving_circuit]")); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'demand_deliver_time'); ?>
<?php echo CHtml::activeTextField($goods,'demand_deliver_time',array('name'=>"goods[{$n}][demand_deliver_time]",'value'=>substr($goods->demand_deliver_time,0,16),'size'=>15,'class'=>'required','my_date'=>true)); ?>
<?php $this->widget('application.extensions.calendar.SCalendar',array('inputField'=>"goods_{$n}_demand_deliver_time",'ifFormat'=>'%Y-%m-%d %H:%M','showsTime'=>true));?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'demand_arrival_time'); ?>
<?php echo CHtml::activeTextField($goods,'demand_arrival_time',array('name'=>"goods[{$n}][demand_arrival_time]",'value'=>substr($goods->demand_arrival_time,0,16),'size'=>15,'class'=>'required','my_date'=>true)); ?>
<?php $this->widget('application.extensions.calendar.SCalendar',array('inputField'=>"goods_{$n}_demand_arrival_time",'ifFormat'=>'%Y-%m-%d %H:%M','showsTime'=>true));?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'actual_arrival_time'); ?>
<?php echo CHtml::activeTextField($goods,'actual_arrival_time',array('name'=>"goods[{$n}][actual_arrival_time]",'value'=>substr($goods->actual_arrival_time,0,16),'size'=>15,'class'=>'required','my_date'=>true)); ?>
<?php $this->widget('application.extensions.calendar.SCalendar',array('inputField'=>"goods_{$n}_actual_arrival_time",'ifFormat'=>'%Y-%m-%d %H:%M','showsTime'=>true));?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'shortage'); ?>
<?php echo CHtml::activeDropDownList($goods,'shortage',$goods->getShortageNames(),array('name'=>"goods[{$n}][shortage]")); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'arrival_state'); ?>
<?php echo CHtml::activeDropDownList($goods,'arrival_state',$goods->getArrivalStateNames(),array('name'=>"goods[{$n}][arrival_state]")); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($goods,'special_state'); ?>
<?php echo CHtml::activeDropDownList($goods,'special_state',$goods->getSpecialStateNames(),array('name'=>"goods[{$n}][special_state]")); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($goods,'special_state_detail'); ?>
<?php echo CHtml::activeTextField($goods,'special_state_detail',array('name'=>"goods[{$n}][special_state_detail]",'size'=>30,'maxlength'=>50)); ?>
</div>
<div class="simple" style="border-bottom:0px;">
<label></label>
<input class="del_goods"  type="button" value="删除此货物信息"/>
</div>
</div>
<div class="simple" style="border:1px solid #90b3bc;border-top:0px;line-height:5px;height:5px;margin-left:0px;+margin-bottom:-2px;"></div>
</div><!--end goods_main-->
<?php 
endforeach;
?>
</div><!-- end  goods-->
<div id="deadhead_btn" style="border:1px solid #90b3bc;border-top:0px;padding-left:20px;height:30px;line-height:30px;"><strong>提货行驶信息</strong>
<input type="button" id="add_deadhead" value="添加提货行驶信息"/><input id="sh_deadhead" class="show" type="button" value="隐藏"/>
</div>
<div id="deadhead_info">
<?php if(isset($deadhead_models)) foreach($deadhead_models as $n=>$deadhead):?>
<div class="deadhead_main">
<div id="leftaa"  style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($deadhead,'origin'); ?>
<?php echo CHtml::activeTextField($deadhead,'origin',array('name'=>"deadhead[$n][origin]",'class'=>'required','size'=>20,'maxlength'=>50)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($deadhead,'destination'); ?>
<?php echo CHtml::activeTextField($deadhead,'destination',array('name'=>"deadhead[$n][destination]",'class'=>'required','size'=>20,'maxlength'=>50)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($deadhead,'mileage'); ?>
<?php echo CHtml::activeTextField($deadhead,'mileage',array('name'=>"deadhead[$n][mileage]",'class'=>'required','my_float'=>8.2,'format'=>'%.2f')); ?>
</div>
<div class="simple1" style="border-bottom:0px;">
<?php echo CHtml::activeLabelEx($deadhead,'fuel_name'); ?>
<?php echo CHtml::activeDropDownList($deadhead,'fuel_name',$deadhead->getFuelNames(),array('name'=>"deadhead[$n][fuel_name]")); ?>
</div>
</div>
<div id="rightaa"  style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($deadhead,'gas_fee'); ?>
<?php echo CHtml::activeTextField($deadhead,'gas_fee',array('name'=>"deadhead[$n][gas_fee]",'my_float'=>8.2,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($deadhead,'bridge_charge'); ?>
<?php echo CHtml::activeTextField($deadhead,'bridge_charge',array('name'=>"deadhead[$n][bridge_charge]",'my_float'=>8.2,'format'=>'%.2f')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($deadhead,'deadhead_reason'); ?>
<?php echo CHtml::activeTextField($deadhead,'deadhead_reason',array('name'=>"deadhead[$n][deadhead_reason]",'class'=>'required','size'=>20,'maxlength'=>200)); ?>
</div>
<div class="simple1"  style="border-bottom:0px;">
<?php echo CHtml::activeLabelEx($deadhead,'driving_circuit'); ?>
<?php echo CHtml::activeDropDownList($deadhead,'driving_circuit',$deadhead->getDrivingCircuitNames(),array('name'=>"deadhead[{$n}][driving_circuit]")); ?>
&nbsp;&nbsp;&nbsp;&nbsp;<input class="del_deadhead"  type="button" value="删除此行驶信息"/>
</div>
</div>
<div class="simple" style="	border:1px solid #90b3bc;border-top:0px;line-height:5px;height:5px;margin-left:0px;+margin-bottom:-2px;" ></div>
</div><!-- end deadhead_main -->
<?php endforeach;?>
</div><!-- end deadhead_info -->
</div><!--end heaven-->
<div id="empty">
<div id="leftaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'origin'); ?>
<?php echo EHtml::activeTextField($model,'origin',array('size'=>20,'maxlength'=>50)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'destination'); ?>
<?php echo EHtml::activeTextField($model,'destination',array('size'=>20,'maxlength'=>50)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'fuel_name'); ?>
<?php if(empty($model->fuel_name)) $model->fuel_name='empty_driving';?>
<?php echo CHtml::activeDropDownList($model,'fuel_name',$model->getFuelNames()); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'driving_circuit'); ?>
<?php echo EHtml::activeDropDownList($model,'driving_circuit',$model->getDrivingCircuitNames()); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'mileage'); ?>
<?php echo EHtml::activeTextField($model,'mileage',array('id'=>'mileage','size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
</div>
</div><!--end leftaa-->
 <div id="rightaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'bridge_charge'); ?>
<?php echo EHtml::activeTextField($model,'bridge_charge',array('id'=>'bridge_charge','size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'extra_cost'); ?>
<?php echo EHtml::activeTextField($model,'extra_cost',array('size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'gas_amount'); ?>
<?php echo EHtml::activeTextField($model,'gas_amount',array('size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'gas_fee'); ?>
<?php echo EHtml::activeTextField($model,'gas_fee',array('size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'driver_salary'); ?>
<?php echo EHtml::activeTextField($model,'driver_salary',array('id'=>'driver_salary','size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'total_cost'); ?>
<?php echo EHtml::activeTextField($model,'total_cost',array('id'=>'total_cost','size'=>10,'format'=>'%.2f')); ?>
</div>
</div><!--end rightaa-->
</div><!--end empty-->
</div><!-- end app_info -->
<div id="driving_info">
<div id="leftaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'front_mileage'); ?>
<?php echo EHtml::activeTextField($model,'front_mileage',array('size'=>7,'format'=>'%.2f','readOnly'=>'true','class'=>'readonly')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'empty_mileage'); ?>
<?php echo EHtml::activeTextField($model,'empty_mileage',array('size'=>7,'format'=>'%.2f','readOnly'=>'true','class'=>'readonly')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'light_mileage'); ?>
<?php echo EHtml::activeTextField($model,'light_mileage',array('size'=>7,'format'=>'%.2f','readOnly'=>'true','class'=>'readonly')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'heavy_mileage'); ?>
<?php echo EHtml::activeTextField($model,'heavy_mileage',array('size'=>7,'format'=>'%.2f','readOnly'=>'true','class'=>'readonly')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'front_fuel'); ?>
<?php echo EHtml::activeTextField($model,'front_fuel',array('size'=>7,'format'=>'%.2f','readOnly'=>'true','class'=>'readonly')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'empty_fuel'); ?>
<?php echo EHtml::activeTextField($model,'empty_fuel',array('size'=>7,'format'=>'%.2f','readOnly'=>'true','class'=>'readonly')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'light_fuel'); ?>
<?php echo EHtml::activeTextField($model,'light_fuel',array('size'=>7,'format'=>'%.2f','readOnly'=>'true','class'=>'readonly')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'heavy_fuel'); ?>
<?php echo EHtml::activeTextField($model,'heavy_fuel',array('size'=>7,'format'=>'%.2f','readOnly'=>'true','class'=>'readonly')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'front_cost'); ?>
<?php echo EHtml::activeTextField($model,'front_cost',array('size'=>7,'format'=>'%.2f')); ?>
</div>
<div class="simple1"  style="border-bottom:0px;">
<?php echo CHtml::activeLabelEx($model,'light_cost'); ?>
<?php echo EHtml::activeTextField($model,'light_cost',array('size'=>7,'format'=>'%.2f')); ?>
</div>
</div><!-- end leftaa -->
<div id="rightaa" style="width:400px;border-top:0px; border-bottom:0px；">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'actual_front_mileage'); ?>
<?php echo EHtml::activeTextField($model,'actual_front_mileage',array('size'=>7,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'actual_empty_mileage'); ?>
<?php echo EHtml::activeTextField($model,'actual_empty_mileage',array('size'=>7,'format'=>'%.2f')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'actual_light_mileage'); ?>
<?php echo EHtml::activeTextField($model,'actual_light_mileage',array('size'=>7,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'actual_heavy_mileage'); ?>
<?php echo EHtml::activeTextField($model,'actual_heavy_mileage',array('size'=>7,'format'=>'%.2f')); ?>
&nbsp;&nbsp;<input id="calculate_fuel_mileage" type="button" value="计算各状态里程"/>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'actual_front_fuel'); ?>
<?php echo EHtml::activeTextField($model,'actual_front_fuel',array('size'=>7,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'actual_empty_fuel'); ?>
<?php echo EHtml::activeTextField($model,'actual_empty_fuel',array('size'=>7,'format'=>'%.2f')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'actual_light_fuel'); ?>
<?php echo EHtml::activeTextField($model,'actual_light_fuel',array('size'=>7,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'actual_heavy_fuel'); ?>
<?php echo EHtml::activeTextField($model,'actual_heavy_fuel',array('size'=>7,'format'=>'%.2f')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'empty_cost'); ?>
<?php echo EHtml::activeTextField($model,'empty_cost',array('size'=>7,'format'=>'%.2f')); ?>
</div>
<div class="simple1" style="border-bottom:0px;">
<?php echo CHtml::activeLabelEx($model,'heavy_cost'); ?>
<?php echo EHtml::activeTextField($model,'heavy_cost',array('size'=>7,'format'=>'%.2f')); ?>
</div>
</div><!-- end rightaa -->
<div class="simple"  style="width:801px;clear: left;border:1px solid #90b3bc;background-color: #EBF4FB;border-top:0px;border-bottom:0px;margin-left:0px;">
<?php echo CHtml::activeLabelEx($model,'mileage'); ?>
<?php echo EHtml::activeTextField($model,'mileage',array('readOnly'=>'true','class'=>'readonly','size'=>7,'format'=>'%.2f')); ?>&nbsp;&nbsp;&nbsp;&nbsp;<input id="calculate_mileage" type="button" value="计算总里程"/>
</div>
<div style="width:781px;clear: left;border:1px solid #90b3bc;margin-left:0px;height:30px;line-height:30px;padding-left:20px;"><strong>收入费用信息</strong></div>
</div><!-- end driving_info -->
<div id="income_info">
<div id="amount_kind" class="simple" style=" border:1px solid #90b3bc;border-top:0px;background-color: #EBF4FB;margin-left:0px;">
<?php echo CHtml::activeLabelEx($model,'amount_kind'); ?>
<?php echo EHtml::activeDropDownList($model,'amount_kind',$model->getAmountKindNames()); ?>
</div>
<div class="simple1" style="width:401px;float:left;border-top:0px;margin-left:0px;">
<?php echo CHtml::activeLabelEx($model,'advance_payment'); ?>
<?php echo EHtml::activeTextField($model,'advance_payment',array('size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple1" style="width:400px;float:left;border-top:0px;">
<?php echo CHtml::activeLabelEx($model,'balance'); ?>
<?php echo EHtml::activeTextField($model,'balance',array('size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple1"style="border-top:0px;width:801px;margin-left:0px;">
<?php echo CHtml::activeLabelEx($model,'special_reasons'); ?>
<?php echo EHtml::activeTextField($model,'special_reasons',array('size'=>80)); ?>
</div>
<div class="simple"  style="width:801px;clear: left;border:1px solid #90b3bc;background-color: #EBF4FB;border-top:0px;margin-left:0px;">
<?php echo CHtml::activeLabelEx($model,'total_amount'); ?>
<?php echo EHtml::activeTextField($model,'total_amount',array('size'=>10,'format'=>'%.2f')); ?>
</div>
</div><!-- end income_info -->
<div id="cost_info">

<div id="gas_btn" style="border:1px solid #90b3bc;border-top:0px;">
<input type="button" id="add_gas" value="添加油费信息"/><input id="sh_gas_fee" class="show" type="button" value="隐藏"/>
</div>
<div id="gas">
<?php foreach($gas_models as $n=>$gas):?>
<div class="gas_main">
<div id="leftaa" style="width:400px;border-top:0px;border-bottom:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($gas,'unit_price'); ?>
<?php echo CHtml::activeTextField($gas,'unit_price',array('name'=>"gas[{$n}][unit_price]",'class'=>'required','my_float'=>16.2,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($gas,'amount'); ?>
<?php echo CHtml::activeTextField($gas,'amount',array('name'=>"gas[{$n}][amount]",'class'=>'required','my_float'=>8.2,'format'=>'%.2f')); ?>
</div>
</div>
  <div id="rightaa" style="width:400px;border-top:0px;border-bottom:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($gas,'cost'); ?>
<?php echo CHtml::activeTextField($gas,'cost',array('name'=>"gas[{$n}][cost]",'class'=>'required','my_float'=>16.2,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<label></label>
<input class="calculate_gas_fee"  type="button" value="计算此油费"/>
<input class="del_gas_fee"  type="button" value="删除此油费"/>
</div>
</div>
<div class="simple" style="border:1px solid #90b3bc;border-top:0px; height:5px;line-height:5px;+margin-bottom:-2px;margin-left:0px;"></div>
</div><!--end gas_main-->
<?php 
endforeach;
?>
</div><!-- end  gas-->
<div id="extra_btn" style="border:1px solid #90b3bc;border-top:0px;">
<input type="button" id="add_extra" value="添加其他费用"/><input id="sh_extra" class="show" type="button" value="隐藏"/>
</div>
<div id="extra_info">
<?php foreach($extra_models as $n=>$extra):?>
<div class="extra_main">
<div id="leftaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($extra,'item'); ?>
<?php echo CHtml::activeDropDownList($extra,'item',$extra->getItemNames(),array('name'=>"extra[{$n}][item]")); ?>
</div>
</div>
  <div id="rightaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($extra,'cost'); ?>
<?php echo CHtml::activeTextField($extra,'cost',array('name'=>"extra[{$n}][cost]",'class'=>'required','my_float'=>16.2,'format'=>'%.2f')); ?>
<input class="del_extra"  type="button" value="删除"/>
</div>
</div>
</div><!--end extra_main-->
<?php 
endforeach;
?>
</div><!-- end  extra_info-->
<div class="simple" style="border:1px solid #90b3bc;border-top:0px;margin-left:0px;height:5px;line-height:5px;+margin-bottom:-2px;"></div>
<div id="leftaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'bridge_charge'); ?>
<?php echo EHtml::activeTextField($model,'bridge_charge',array('size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'driver_salary'); ?>
<?php echo EHtml::activeTextField($model,'driver_salary',array('size'=>10,'format'=>'%.2f')); ?>
&nbsp;&nbsp;<input id="calculate_driver_salary" type="button" value="计算司机绩效"/>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'charge_off_sum'); ?>
<?php echo EHtml::activeTextField($model,'charge_off_sum',array('size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple1" style="border-bottom:0">

</div>
</div>
<div id="rightaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'amerce_cost'); ?>
<?php echo EHtml::activeTextField($model,'amerce_cost',array('size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($model,'damage_cost'); ?>
<?php echo EHtml::activeTextField($model,'damage_cost',array('size'=>10,'format'=>'%.2f')); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($model,'total_cost'); ?>
<?php echo EHtml::activeTextField($model,'total_cost',array('size'=>10,'format'=>'%.2f')); ?>
&nbsp;&nbsp;<input id="calculate_total_cost" type="button" value="计算总费用"/>
</div>
<div class="simple1" style="border-bottom:0">
<?php echo CHtml::activeLabelEx($model,'total_profit'); ?>
<?php echo EHtml::activeTextField($model,'total_profit',array('size'=>10,'format'=>'%.2f')); ?>
&nbsp;&nbsp;<input id="calculate_total_profit" type="button" value="计算总利润"/>
</div>
</div>
</div><!-- end cost info -->
<div style="width:781px;clear: left;border:1px solid #90b3bc;border-top:0;border-bottom:0;margin-left:0px;line-height:30px;padding-left:20px;"><strong>其他信息</strong></div>
<div id="other_info">
<div id="leftaa"  style="width:400px;border-top:0px;">
<div class="simple1" >
<?php echo CHtml::activeLabelEx($model,'driver_prepaid'); ?>
<?php echo EHtml::activeTextField($model,'driver_prepaid',array('size'=>10,'format'=>'%.2f','readOnly'=>'true','class'=>'readonly')); ?>
</div>
<div class="simple" >
<?php echo CHtml::activeLabelEx($model,'driver_repayment'); ?>
<?php echo EHtml::activeTextField($model,'driver_repayment',array('size'=>10,'format'=>'%.2f')); ?>
</div>
</div>
  <div id="rightaa"  style="width:400px;border-top:0;">
<div class="simple1" >
<?php echo CHtml::activeLabelEx($model,'prepaid_place'); ?>
<?php echo EHtml::activeTextField($model,'prepaid_place',array('size'=>30,'readOnly'=>'true','class'=>'readonly')); ?>
</div>
<div class="simple" >
<?php echo CHtml::activeLabelEx($model,'repayment_place'); ?>
<?php echo EHtml::activeTextField($model,'repayment_place',array('size'=>30)); ?>
</div>
</div>
<div class="simple4"  style="width:781px;">
<?php echo CHtml::activeLabelEx($model,'remark'); ?>
<?php echo EHtml::activeTextArea($model,'remark',array('rows'=>6, 'cols'=>75, 'maxlength'=>200)); ?>
</div>
<div class="simple4"  style="width:781px;">
<?php echo CHtml::activeLabelEx($model,'return_paper'); ?>
<?php echo CHtml::activeRadioButtonList($model,'return_paper',$model->getReturnPaperNames(),array('separator'=>' '));?>
</div>
</div><!-- end other_info -->
<div class="action">
<?php echo EHtml::submitButton($update ? '更新信息' : '确认信息'); ?>
</div>
<?php echo EHtml::endForm(); ?>
</div><!-- yiiForm -->
<div id="temp" style="display:none">
<div class="deadhead_temp" >
<div id="leftaa"  style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($deadhead_temp,'origin'); ?>
<?php echo CHtml::activeTextField($deadhead_temp,'origin',array('name'=>"deadhead[0][origin]",'class'=>'required','size'=>20,'maxlength'=>50)); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($deadhead_temp,'destination'); ?>
<?php echo CHtml::activeTextField($deadhead_temp,'destination',array('name'=>"deadhead[0][destination]",'class'=>'required','size'=>20,'maxlength'=>50)); ?>
</div>
<div class="simple">
<?php echo CHtml::activeLabelEx($deadhead_temp,'mileage'); ?>
<?php echo CHtml::activeTextField($deadhead_temp,'mileage',array('name'=>"deadhead[0][mileage]",'class'=>'required','my_float'=>8.2,'format'=>'%.2f')); ?>
</div>
<div class="simple1"   style="border-bottom:0px;">
<?php echo CHtml::activeLabelEx($deadhead_temp,'fuel_name'); ?>
<?php if(empty($deadhead_temp->fuel_name)) $deadhead_temp->fuel_name='empty_driving';?>
<?php echo CHtml::activeDropDownList($deadhead_temp,'fuel_name',$deadhead_temp->getFuelNames(),array('name'=>"deadhead[0][fuel_name]")); ?>
</div>
</div>
<div id="rightaa"  style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($deadhead_temp,'gas_fee'); ?>
<?php echo CHtml::activeTextField($deadhead_temp,'gas_fee',array('name'=>"deadhead[0][gas_fee]",'my_float'=>8.2,'format'=>'%.2f')); ?>
</div>
<div class="simple1">
<?php echo CHtml::activeLabelEx($deadhead_temp,'bridge_charge'); ?>
<?php echo CHtml::activeTextField($deadhead_temp,'bridge_charge',array('name'=>"deadhead[0][bridge_charge]",'my_float'=>8.2,'format'=>'%.2f')); ?>
</div>
<div class="simple" >
<?php echo CHtml::activeLabelEx($deadhead_temp,'deadhead_reason'); ?>
<?php echo CHtml::activeTextField($deadhead_temp,'deadhead_reason',array('name'=>"deadhead[0][deadhead_reason]",'class'=>'required','size'=>20,'maxlength'=>200)); ?>
</div>
<div class="simple1"  style="border-bottom:0px;">
<?php echo CHtml::activeLabelEx($deadhead_temp,'driving_circuit'); ?>
<?php echo CHtml::activeDropDownList($deadhead_temp,'driving_circuit',$deadhead_temp->getDrivingCircuitNames(),array('name'=>"deadhead[0][driving_circuit]")); ?>
&nbsp;&nbsp;&nbsp;&nbsp;<input class="del_deadhead"  type="button" value="删除此行驶信息"/>
</div>
</div>
<div class="simple" style="	border:1px solid #90b3bc;border-top:0px;line-height:5px;+margin-bottom:-2px;height:5px;margin-left:0px;" ></div>
</div><!-- end deadhead_temp -->
<div class="extra_temp">
<div id="leftaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($extra_temp,'item'); ?>
<?php echo CHtml::activeDropDownList($extra_temp,'item',$extra_temp->getItemNames(),array('name'=>"extra[0][item]")); ?>
</div>
</div>
  <div id="rightaa" style="width:400px;border-top:0px;">
<div class="simple">
<?php echo CHtml::activeLabelEx($extra_temp,'cost'); ?>
<?php echo CHtml::activeTextField($extra_temp,'cost',array('name'=>"extra[0][cost]",'class'=>'required','my_float'=>16.2,'format'=>'%.2f')); ?>
<input class="del_extra"  type="button" value="删除"/>
</div>
</div>
</div><!--end extra_temp-->
</div><!-- end temp -->
<?php 
if($model->hasErrors()) echo "<script>alert('您填写的信息有误！请根据页面红色图标提示修改。');</script>";
?>